from django.utils.deprecation import MiddlewareMixin
from mydjango.settings import SECRET_TOKEN
import jwt
from django.http import HttpResponse,HttpResponseRedirect,JsonResponse

class row_login(MiddlewareMixin):

    def process_request(self,request):
        # uid = request.GET.get('uid')
        # token = request.GET.get('token',None)
        # no_token_list = ['/register/','/mycode/','/login/','/weibo_back/','/dingding_back/']
        #
        # if token:
        #     path = request.path
        #     if path in no_token_list:
        #         return
        #
        #     if path == '/qiniu/':
        #         if request.method == 'GET':
        #             return
        #     if path == '/uploadfile/':
        #         if request.method == 'POST':
        #             return
        #
        #     token_decode = jwt.decode(token, SECRET_TOKEN)
        #
        #     if str(token_decode['uid']) != uid:
        #         return JsonResponse({'error': "请求错误"})
        # else:
        #     return HttpResponse('没有令牌')
        pass